<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%@ page import="board1.ChonDAO"%>
<%@ page import="board1.ChonTO"%>
<%@ page import="java.util.ArrayList"%>

<%
	request.setCharacterEncoding("UTF-8");

	ChonDAO dao = new ChonDAO();

	ArrayList<ChonTO> data = dao.listChon();

	String chon_list = "";

	for (int i = 0; i < data.size(); i++) {
		ChonTO to = (ChonTO) data.get(i);
		String chon_id = to.getChon_id();
		String chon_nm = to.getChon_nm();
		String chon_small_img = to.getChon_small_img();

		if (i == 0) {
			chon_list += "{" + "\"chon_id\"" + ":\"" + chon_id + "\","
					+ "\"chon_nm\"" + ":\"" + chon_nm + "\","
					+ "\"chon_small_img\"" + ":\"" + chon_small_img
					+ "\"}";
		} else {
			chon_list += ",{" + "\"chon_id\"" + ":\"" + chon_id + "\","
					+ "\"chon_nm\"" + ":\"" + chon_nm + "\","
					+ "\"chon_small_img\"" + ":\"" + chon_small_img
					+ "\"}";
		}
	}

	if (chon_list.equals(""))
		chon_list = "FAIL";
	else
		chon_list = "[" + chon_list + "]";

	out.println(chon_list);
%>

